<?php
// +----------------------------------------------------------------------
// | snake
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 http://baiyf.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: NickBai <1902822973@qq.com>
// +----------------------------------------------------------------------
namespace app\common\model;

use think\Model;

class Extract extends Model
{

    public static $status = [
        '0' => '未处理',
        '1' => '申请成功',
        '2' => '申请失败',
    ];

    public function allExtract($where, $offset, $limit)
    {
        return $this->where($where)->limit($offset, $limit)->order('status Asc, id Asc')->select();
    }

    public static function add($data)
    {
        $data['create_time'] = time();
        return self::create($data);
    }

    // 关联账户
    public function user()
    {
        return $this->belongsTo('User', 'user_id');
    }
}
